package com.xquant.system.api.factory;

import com.xquant.common.core.domain.R;
import com.xquant.system.api.RemotePermService;
import com.xquant.system.api.RemoteUserService;
import com.xquant.system.api.domain.SysUser;
import com.xquant.system.api.model.LoginUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 用户服务降级处理
 *
 * @author xquant
 */
@Component
public class RemotePermFallbackFactory implements FallbackFactory<RemotePermService>
{
    private static final Logger log = LoggerFactory.getLogger(RemotePermFallbackFactory.class);

    @Override
    public RemotePermService create(Throwable throwable)
    {
        log.error("业务权限服务调用失败:{}", throwable.getMessage());
        return new RemotePermService()
        {
            @Override
            public List<Map> getFilterAuth(List<Map> list, String authType)
            {
                return list;
            }
            @Override
            public String getPermFlag(String authType)
            {
                return "0";
            }

        };
    }
}
